home *** CD-ROM | disk | FTP | other *** search
/ Giga Games 1 / Giga Games.iso / net / hack / 3_1_3 / unpack.scr next >
Encoding:
Text File  |  1993-07-24  |  3.1 KB  |  139 lines

  1. #!/bin/sh
  2. # unpack.script -- UNIX shell script to unpack nethack archives
  3. #
  4. # This eliminates a lot of the tedium from snarfing a new nethack version
  5. # from linc.cis.upenn.edu.  It automatically creates appropriate directories,
  6. # undoes uuencoding and compression, and untars tar files.  When it's done
  7. # running you should have a complete clean source-tree.
  8.  
  9. # System V style tars need the addition of the o option here
  10. #
  11. # If you didn't change this before running the script, you at least own
  12. # the created directories, so you can slowly and painfully rename and copy
  13. # each file so that you own it (or write your own simple script to
  14. # automate the process).  Using chown with superuser privileges is of
  15. # course a much quicker recovery...
  16. #
  17. TAROPTS=xvf
  18. # TAROPTS=xovf
  19.  
  20.  
  21. # Changes to the source set should require at most additions to ARCHIVES
  22. # and (possibly) additions to the case statement mapping archives to
  23. # subdirectory names.
  24. #
  25. ARCHIVES1="Top Dat1 Dat2 Dat3 Dat4 Doc1 Doc2 Doc3 Incl1 Incl2 Incl3 Incl4 Util1 Util2"
  26. ARCHIVES2="Src1 Src2 Src3 Src4 Src5 Src6 Src7 Src8 Src9 Src10 Src11 Src12 Src13 Src14 Src15 Src16 Src17 Src18 Src19 Src20 Src21 Src22 Src23 Src24 Src25 Src26 Src27 Src28"
  27. ARCHIVES3="Amiga1 Amiga2 Amiga3 Amiga4 Amiga5 Amiga6 Amiga7 AmiSpl Atari Mac1 Mac2 Mac3 Mac4 Mac5 Mac6 Msdos1 Msdos2 Msdos3"
  28. ARCHIVES4="NT Os2 Shr1 Shr2 Shr3 Snd1 Snd2 Snd3 Snd4 Snd5 Unx1 Unx2 Vms1 Vms2 Vms3 Tty X1 X2 X3"
  29.  
  30. # unconditionally create directories we may try to create subdirectories of
  31. if [ ! -d sys ]
  32. then
  33.     mkdir sys
  34. fi
  35. if [ ! -d sys/amiga ]
  36. then
  37.     mkdir sys/amiga
  38. fi
  39. if [ ! -d sys/share ]
  40. then
  41.     mkdir sys/share
  42. fi
  43. if [ ! -d win ]
  44. then
  45.     mkdir win
  46. fi
  47.  
  48. if [ -f Shr.termcap.uu ]
  49. then
  50.     if [ ! -d sys/share ]
  51.     then
  52.         mkdir sys/share
  53.     fi
  54.     mv Shr.termcap.uu sys/share/termcap.uu
  55. fi
  56.  
  57. for i in NHproj.hqx NHsound.hqx
  58. do
  59.     if [ -f Mac.$i ]
  60.     then
  61.         if [ ! -d sys/mac ]
  62.         then
  63.             mkdir sys/mac
  64.         fi
  65.         mv Mac.$i sys/mac/$i
  66.     fi
  67. done
  68.  
  69. for i in 1 2 3
  70. do
  71.     if [ -f Cpp$i.shr ]
  72.     then
  73.         if [ ! -d sys/unix ]
  74.         then
  75.             mkdir sys/unix
  76.         fi
  77.         mv Cpp$i.shr sys/unix/cpp$i.shr
  78.     fi
  79. done
  80.  
  81. topdir=`pwd`
  82.  
  83. for f in $ARCHIVES1 $ARCHIVES2 $ARCHIVES3 $ARCHIVES4
  84. do
  85.     if [ -f ${f}.tar.Z.uu ]
  86.     then
  87.         uudecode ${f}.tar.Z.uu; rm ${f}.tar.Z.uu
  88.     fi
  89.     if [ -f ${f}.tar.Z ]
  90.     then
  91.         compress -d ${f}.tar.Z
  92.     fi
  93.  
  94.     if [ -f ${f}.tar ]
  95.     then
  96.         # Here's the part that may need hacking as we add more machines
  97.         case $f in
  98.             Amiga*) dir=sys/amiga;;
  99.             AmiSpl*) dir=sys/amiga/splitter;;
  100.             Atari*) dir=sys/atari;;
  101.             Dat*) dir=dat;;
  102.             Doc*) dir=doc;;
  103.             Incl*) dir=include;;
  104.             Mac*) dir=sys/mac;;
  105.             Msdos*) dir=sys/msdos;;
  106.             NT*) dir=sys/winnt;;
  107.             Os2*) dir=sys/os2;;
  108.             Shr*) dir=sys/share;;
  109.             Snd*) dir=sys/share/sounds;;
  110.             Src*) dir=src;;
  111.             Top*) dir=.;;
  112.             Unx*) dir=sys/unix;;
  113.             Util*) dir=util;;
  114.             Vms*) dir=sys/vms;;
  115.             Tty*) dir=win/tty;;
  116.             X*) dir=win/X11;;
  117.         esac
  118.  
  119.         echo Unpacking $f.tar into $dir ...
  120.         if [ ! -d $dir ]
  121.         then
  122.             mkdir $dir
  123.         fi
  124.         if [ $dir != "." ]
  125.         then
  126.             mv $f.tar $dir;
  127.             cd $dir
  128.         fi
  129.         tar $TAROPTS $f.tar
  130.         rm $f.tar
  131.         if [ $dir != "." ]
  132.         then
  133.             cd $topdir
  134.         fi
  135.     fi
  136. done
  137.  
  138. echo "Remember to run sys/unix/setup.sh if you're compiling for UNIX."
  139.